<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>短信平台系统</title>
<meta name="author" content="" />
<link rel="stylesheet" type="text/css" href="__STATIC__/index/css/style.css" />
<style>
body{height:100%;background:#16a085;overflow:hidden;}
canvas{z-index:-1;position:absolute;}
a,body,select{font-size:12px;text-decoration:none;}
a,pre{color:#808080;}
</style>
<script src="__STATIC__/index/js/jquery.js"></script>
<script src="__STATIC__/index/js/Particleground.js"></script>
<script src="__STATIC__/index/js/layer/layer.js"></script>
<script src="__STATIC__/index/js/area/PCASClass.js"></script>
</head>
<script>
	$(document).ready(function() {
		//粒子背景特效
	    $('body').particleground({
			dotColor: '#5cbdaa',
			lineColor: '#5cbdaa'
		});
	  

        $(".yzm").click(function(){
            if( $(this).attr("src").indexOf('?')>0){
                $(this).attr("src", $(this).attr("src")+'&random='+Math.random());
            }else{
                $(this).attr("src", $(this).attr("src").replace(/\?.*$/,'')+'?'+Math.random());
            }
        });
	});
</script>
<style type="text/css">
	#dd,
	#dd p{
		font-size: 14px; line-height: 28px; padding: 10px 0 16px 6px; color: #fff;
		padding: 0;
		margin: 0;	
	}
</style>
<body>
<form action="{:url('Login/registered_do')}" method="post" id="loginForm"/>
<input type="hidden" name="hetong" id="hetong" value="0">
  <dl class="admin_login">
   <dt>
    <strong>注册短信平台</strong>
   </dt>
   <dd class="user_icon">
    <input type="number" placeholder="手机号码" class="login_txtbx" name="account" id="account"/>
   </dd>
   <dd class="pwd_icon">
    <input type="password" placeholder="密码" class="login_txtbx" name="passwd" id="passwd"/>
   </dd>
   <dd class="pwd_icon">
    <input type="password" placeholder="确认密码" class="login_txtbx" name="confirm_password" id="confirm_password"/>
   </dd>
   <dd>
    	<input style="text-indent:0" type="text" placeholder="企业名" class="login_txtbx" name="company" id="company"/>
   </dd>
   <dd>
    	<input style="text-indent:0" type="text" placeholder="联系人" class="login_txtbx" name="contact" id="contact"/>
   </dd>
   <dd>
    	<select name="parent_cat" style="width: 32.4%;height: 42px;line-height: 42px;padding: 0px;text-indent:0em;" class="login_txtbx parent_cat select" onchange="category_nav(this);select(this)">
   			<option value="0">请选择行业分类</option>
   			{volist name="industry_category" id="vo"}
   			<option value="{$vo.id}">{$vo.name}</option>
   			{/volist}
   		</select>
   		<span id="parent_nav_cat">
	   		
   		</span>   		
		<select name="industry" id="industry" style="width: 32.4%;height: 42px;line-height: 42px;padding: 0px;text-indent:0em;" class="login_txtbx">
			<option value="">请选择行业</option>
		</select>   		
   </dd>
   <dd>
   		<select name="province" style="width: 32.4%;height: 42px;line-height: 42px;padding: 0px;text-indent:0em;" class="login_txtbx province">
   			
   		</select>
   		<select name="city" style="width: 32.4%;height: 42px;line-height: 42px;padding: 0px;text-indent:0em;" class="login_txtbx city">

   		</select>
   		<select name="area" style="width: 32.4%;height: 42px;line-height: 42px;padding: 0px;text-indent:0em;" class="login_txtbx area">
   		</select>
    	<!-- <input style="text-indent:0" type="text" placeholder="所在地区" class="login_txtbx" name="users_location" id="users_location"/> -->
   </dd>
   <dd>
    	<input style="text-indent:0" type="text" placeholder="固定电话" class="login_txtbx" name="telephone" id="telephone"/>
   </dd>
   <dd>
    	<input style="text-indent:0" type="number" placeholder="qq" class="login_txtbx" name="qq" id="qq"/>
   </dd>
   <dd>
    	<input style="text-indent:0" type="text" placeholder="email" class="login_txtbx" name="email" id="email"/>
   </dd>
   <dd class="val_icon">
    <div class="checkcode">
      <input type="text" placeholder="验证码" maxlength="5" name="verifyCode" class="login_txtbx" id="verify_code">
    </div>
    <img src="/index/Login/captchaImg" alt="captcha" class="yzm"  title="换一张" width="170" height="42" style="float:right; display:block; cursor:pointer;" />
    </dd>
    <dd id="dd">
   		注册帮助： <div style="display: inline-block;">{$value}</div>
   	</dd>
   <dd>
   	<div style="width:100%">
	    <input type="submit" value="注册" class="submit_btn" style="width:50%"/>
	    <input type="button" value="返回登陆" class="registered_btn" style="width:48%"/>
	</div>
   </dd>
  </dl>
</form>
<script>
	$(".registered_btn").click(function(){
    	location.href = "{:url('Login/login')}";
	});

	new PCAS("province","city","area","","","");

	$(".submit_btn").click(function(){
			var account = $("#account").val();

			if($("#account").val()==""){
				alert("手机号码不能为空!");
				return false;
			}

			var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
	        if (!myreg.test(account)) {
	        	alert("账号请填写手机号!");
	            return false;
	        } 

			if($("#passwd").val()==""){
				alert("密码不能为空!");
				return false;
			}
			
			if($("#confirm_password").val()==""){
				alert("确认密码不能为空!");
				return false;
			}

			if($("#passwd").val() != $("#confirm_password").val()){
				alert("请密码与确认密码请一致!");
				return false;
			}

			if($("#company").val()==""){
				alert("请填写企业名!");
				return false;
			}			

			if($("#contact").val()==""){
				alert("请填写联系人!");
				return false;
			}

			var industry = $("#industry").val();
			
			if(industry == "" || industry == null){
				alert("请选择行业！");
				return false;
			}

			if($("#user_industry").val()==""){
				alert("请填写所在行业!");
				return false;
			}

			if($(".province").val() == "" || $(".city").val() == "" || $(".area").val() == ""){
				alert("请选择所在地区!");
				return false;
			}

			var qq_value = $("#qq").val();
			var qq = /[1-9][0-9]{4,14}/;
			if (!qq.test(qq_value) && qq_value != "") {
	        	alert("请填写正确qq!");
	            return false;
	        }

			var pattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

			if (!pattern.test($("#email").val()) && $("#email").val() != "") {
	        	alert("请填写正确邮箱!");
	            return false;
	        }

			if($("#verify_code").val()==""){
				alert("验证码不能为空!");
				return false;
			}
			
			var hetong = $("#hetong").val();
			if(hetong == '0'){
				var url = "{:url('Login/contract_display',['id'=>'3'])}";

				//页面层
				layer.open({
				  type: 2,
				  title: 'layer mobile页',
				  area: ['100%', '90%'],
				  content: url //iframe的url
				}); 

				return false;
			}
		});

	function category_nav(obj){
		var parent_cat = $(obj).val();
		var formData = new FormData();

		formData.append('parent_id',parent_cat);

		$.ajax({
            url:"{:url('Industry/select_catgory_result')}",
            type:'POST',
            data:formData,
            async:false,
            processData:false,
            contentType:false,
            success:function(result){
                if(result.msg.length != 0 && parent_cat != 0){
                    var html = '<select name="parent_nav_cat" style="width: 32.4%;height: 42px;line-height: 42px;padding: 0px;text-indent:0em;" class="login_txtbx parent_nav_cat" onchange="select(this)">';
                    for (var i = 0; i < result.msg.length; i++) {
                        html +='<option value="'+result.msg[i].id+'">'+result.msg[i].name+'</option>';
                    }
                    html += '</select>';
                    $('#parent_nav_cat').append(html);
                }else{
                	$('#parent_nav_cat').empty();
                }


            }
        });
	}

	//查询行业数据
	function select(obj){
		var formData = new FormData();
		var parent_id = $("select[name='parent_cat']  option:selected").val();
		var nav_id = $("select[name='parent_nav_cat']  option:selected").val();
		$('#industry').empty();

		if(parent_id == '0'){
			return false;
		}
		if(typeof(nav_id) == 'undefined'){
			nav_id = '0';
		}

		formData.append('parent_id',parent_id);
		formData.append('nav_id',nav_id);

		$.ajax({
            url:"{:url('Industry/selects')}",
            type:'POST',
            data:formData,
            async:false,
            processData:false,
            contentType:false,
            success:function(result){
                var html = '';
                	html += '<option value="">请选择行业</option>';
                for (var i = 0; i < result.msg.length; i++) {
                    html +='<option value="'+result.msg[i].id+'">'+result.msg[i].name+'</option>';
                }
                $('#industry').append(html);
            }
        });
	}

	
</script>
</body>
</html>
